﻿/// <reference path="jquery-1.3.2-vsdoc.js">
function fn(action) {
    return ret
    switch (action) {
        case "myjob": fn_myjob(); break;
        case "app": fn_app(); break;
        case "fav": fn_fav(); break;
        case "service": fn_service(); break;
    }
}

function fn_myjob() {
    $.ajax({ url: "/facade/Applican.aspx", cache: false, dataType: "json", data: encodeURI("sort=appDate&s_method=list&query=UserID=" + uid + "&start=0&limit=20"),
        beforeSend: function (x) {
            x.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        },
        //success: function (msg) { alert(objToString(msg)) },
        complete: function (x, state) {
            //var res = "{\"data\":[" + data + "]}";
            var json = eval("(" + x.responseText + ")");
            $.each(json.data, function (idx, item) {
                alert('123');
            });
        }
    });
}

// helper
function objToString(o) {
    var s = '{\n';
    for (var p in o)
        s += '    "' + p + '": "' + o[p] + '"\n';
    return s + '}';
}

// helper
function elementToString(n, useRefs) {
    var attr = "", nest = "", a = n.attributes;
    for (var i = 0; a && i < a.length; i++)
        attr += ' ' + a[i].nodeName + '="' + a[i].nodeValue + '"';

    if (n.hasChildNodes == false)
        return "<" + n.nodeName + "\/>";

    for (var i = 0; i < n.childNodes.length; i++) {
        var c = n.childNodes.item(i);
        if (c.nodeType == 1) nest += elementToString(c);
        else if (c.nodeType == 2) attr += " " + c.nodeName + "=\"" + c.nodeValue + "\" ";
        else if (c.nodeType == 3) nest += c.nodeValue;
    }
    var s = "<" + n.nodeName + attr + ">" + nest + "<\/" + n.nodeName + ">";
    return useRefs ? s.replace(/</g, '&lt;').replace(/>/g, '&gt;') : s;
}